<?php

require_once 'system/DBConnect.php';

/**
 * 
 * @author tmontel
 */

class LocationManager {

    private $a_Location = array();

    private $link = NULL;

    public function getLocations($latMin, $lngMin, $latMax, $lngMax) {
        
        $query = 'SELECT * FROM interest_points
                    WHERE lat > '.$latMin.' AND lat < '.$latMax.'
                      AND lng > '.$lngMin.' AND lng < '.$lngMax;

        $dbConnexion = new DBConnect();
        $result = $dbConnexion->makeRequest($query);

        while ($row = mysql_fetch_object($result)) {
            array_push($this->a_Location, $row);
        }
        return json_encode($this->a_Location);
    }

    /*public function __destruct() {
        mysql_close($link);
    }*/
}
?>
